package cn.tedu.classx;

public class PersonDemo {
    public static void main(String[] args) {
        //创建Person类的对象
        Person p1 = new Person();
        //获取p1对象的属性值--默认值
        System.out.println(p1.name);//null
        System.out.println(p1.age);//0
        //给p1对象的属性赋值
        p1.name = "铁蛋";
        p1.age = 19;
        p1.gender = "男";
        // 查看是否赋值成功
        System.out.println(p1.name);//铁蛋
        System.out.println(p1.age);//19
        System.out.println(p1.gender);//男
        //调用p1对象的方法
        p1.eat();
        p1.sleep();
        //创建Person类的对象
        Person p2 = new Person();
        System.out.println(p2.name);//null
        System.out.println(p2);//cn.tedu.classx.Person@28d93b30 [I@地址值
        p2 = p1;
        System.out.println(p2.name);//
    }
}
